<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:oc="http://java.sun.com/jsf/composite/owncomponents"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="template/template.xhtml">
		<ui:define name="content">
			<h:form id="form" styleClass="horizontal_full">
				<p:panel>
						<h1>Product Update</h1>
							
					    <h:panelGrid id="productConfig" columns="4"  rowClasses="height50">
					    	
					    	<h:outputText value="Name"></h:outputText>
					        <p:inputText id="Name" value="#{adminMBean.productName}" required="true" />
					        <p></p>
					        <oc:fieldhelp helptext="Name of the Product." show="true"/>
					    	
					    	<h:outputText value="Costs"></h:outputText>
					        <p:inputText id="Costs" value="#{adminMBean.productCosts}" required="true"
					        converterMessage="Costs should be positive."
							validatorMessage="Costs should be positive.">
					        	<f:validateDoubleRange minimum="0.0"/>
					        </p:inputText>
					        <p></p>
					        <oc:fieldhelp helptext="Describes the average quality of the product between 0 and 1." show="true"/>
					    	
							<h:outputText value="Quality"></h:outputText>
					        <p:inputText id="Quality" value="#{adminMBean.productQualityFactor}" required="true"
					        converterMessage="Quality Factor should be between 0.1 and 1."
							validatorMessage="Quality Factor should be between 0.1 and 1.">
					        	<f:validateDoubleRange  minimum="0.1" maximum="1.0" />
					        </p:inputText>
					        <p></p>
					        <oc:fieldhelp helptext="Describes the average quality of the product between 0 and 1." show="true"/>
					    	
					    	<h:outputText value="Supplier"></h:outputText>
					    	<p:selectOneMenu id="selectProduct" value="#{adminMBean.productSupplierId}">
				                <f:selectItems value="#{adminMBean.getAllSuppliersDropDown()}" />
				            </p:selectOneMenu>
				            <p></p>
					        <oc:fieldhelp helptext="Supplier that offers this product." show="true"/>  
					        
					        <h:outputText value="Active"></h:outputText>
					    	<p:selectBooleanCheckbox value="#{adminMBean.productActive}" /> 
				            <p></p>
					        <oc:fieldhelp helptext="If the product is active it an be used in the Game." show="true"/>  
					        
					    	
					    </h:panelGrid>
					    
					    <p:commandButton action="#{adminMBean.actionUpdateProduct()}" id="saveButton" value="Save" update=":messages" icon="ui-icon-disk" title="Icon Only" />
						
						<p:commandButton action="#{adminMBean.actionAbortProduct()}" id="abortButton" value="Abort" update=":messages" icon="ui-icon-circle-close" title="Icon Only" immediate="true"/>
						
					</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>